﻿@using Matrix.MaKaYunShang.BLL
@model Matrix.MaKaYunShang.Model.Dto.ViewOrdersDto
@{
    ViewBag.Title = "订单详情";
    var returnUrl = Request["returnUrl"];
    if (string.IsNullOrEmpty(returnUrl))
    {
        ViewBag.PathToBtn = "/Orders/List?orderStatus=" + Request["orderStatus"];
    }
    else
    {
        ViewBag.PathToBtn = returnUrl;
    }
    ViewBag.TextBtn = "返回至列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                订单详情（<font style="font-size: 18px;color: red">状态：@Model.OrderStatus</font>）
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-lg-12">
                        <fieldset>
                            <div class="form-group col-md-6">
                                <label>订单编号</label>
                                @Html.TextBoxFor(model => model.OrderNo, new { @class = "form-control", @readonly = "readonly" })
                            </div>
                            <div class="form-group col-md-6">
                                <label>用户微信昵称</label>
                                <input type="text" readonly="readonly" class="form-control" value="@ViewBag.NickName" />
                            </div>
                        </fieldset>
                    </div>
                </div>
                <div class="row" style="padding-left: 15px; padding-right: 15px;">
                    <div class="col-lg-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h4>店铺信息</h4>
                                店铺名称：@Model.ShopName
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                老板电话：@Model.ShopLegalPersonMobile
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                店铺电话：@Model.ShopTel
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row" style="padding-left: 15px; padding-right: 15px;">
                    <div class="col-lg-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h4>收货信息</h4>
                                姓名：@Model.ReceiverName
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                电话：@Model.ReceiverPhone
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                地址：@Model.ReceiverAddress
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                备注：@Model.Remark
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row" style="padding-left: 15px; padding-right: 15px;">
                    <div class="col-lg-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h4>订单明细</h4>
                            </div>
                            <div class="panel-body">
                                <div class="table-responsive table-bordered">
                                    <table class="table">
                                        <thead>
                                            <tr>
                                                <th>商品名称</th>
                                                <th>规格</th>
                                                <th>单价</th>
                                                <th>数量</th>
                                                <th>总价</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            @foreach (var item in Model.OrderDetailList)
                                            {
                                                <tr>
                                                    <td>@Html.Raw(item.CommodityName + (item.IsGift ? "<font style='color:red'>【赠品】</font>" : ""))</td>
                                                    <td>@item.CommoditySpec</td>
                                                    <td>@item.Price</td>
                                                    <td>@item.Quantity（@item.CommodityUnit）</td>
                                                    <td>@(item.Price * item.Quantity)</td>
                                                </tr>
                                            }
                                            <tr>
                                                <td></td>
                                                <td></td>
                                                <td><b>总计</b></td>
                                                <td><b>@Model.CommodityQuantity</b></td>
                                                <td><b>￥@Model.NormalPrice</b></td>
                                            </tr>
                                            @if (Model.CouponValue > 0)
                                            {
                                                <tr>
                                                    <td></td>
                                                    <td></td>
                                                    <td><b>优惠券</b></td>
                                                    <td></td>
                                                    <td><b>-￥@Model.CouponValue</b></td>
                                                </tr>
                                            }
                                            @if (Model.RandomPayDiscount > 0)
                                            {
                                                <tr>
                                                    <td></td>
                                                    <td></td>
                                                    <td><b>立减金额</b></td>
                                                    <td></td>
                                                    <td><b>-￥@Model.RandomPayDiscount</b></td>
                                                </tr>
                                            }
                                            @if (!string.IsNullOrWhiteSpace(Model.CouponResume))
                                            {
                                                <tr>
                                                    <td></td>
                                                    <td></td>
                                                    <td><b>票券详情</b></td>
                                                    <td></td>
                                                    <td><b>@Html.Raw(Model.CouponResume)</b></td>
                                                </tr>
                                            }
                                            <tr>
                                                <td></td>
                                                <td></td>
                                                <td><b>实际支付</b></td>
                                                <td></td>
                                                <td><b style="color: red;">￥@Model.PayPrice（<b style="color: red;font-size: 18px;">@Model.PayWay</b>）</b></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row" style="padding-left: 15px; padding-right: 15px;">
                    <div class="col-lg-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                配送跟踪
                            </div>
                            <div class="panel-body">
                                <div class="table-responsive">
                                    <table class="table table-striped">
                                        @{
                                            var orderTrackingList = OrderTrackingBLL.Instance.GetOrderTrackByOrderId(Model.Id);
                                            if (orderTrackingList != null)
                                            {
                                                for (var i = 0; i < orderTrackingList.Count; i++)
                                                {
                                                    <tr @(i == 0 ? "style=color:blue;" : "")>
                                                        <td>@orderTrackingList[i].OptDesc</td>
                                                    </tr>
                                                }
                                            }
                                        }
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                @if (!string.IsNullOrEmpty(Model.SysRemark))
                {
                    <div class="row" style="padding-left: 15px; padding-right: 15px;">
                        <div class="col-lg-12">
                            <div class="panel panel-default">
                                <div class="panel-heading">
                                    <h4>订单系统备注</h4>
                                    @Model.SysRemark
                                </div>
                            </div>
                        </div>
                    </div>
                }
            </div>
        </div>
    </div>
</div>